import time
def bubble(sp): 
  k = 0
  for i in range(0,len(sp)-1): 
    for j in range(len(sp)-1): 
        if(sp[j]>sp[j+1]): 
            temp = sp[j] 
            sp[j] = sp[j+1] 
            sp[j+1] = temp 
            k += 1
        if k == 0:
            break
  return sp
sp = []
op = open("m1_sorted.txt")
for i in op:
  sp.append(int(i))
start = time.time()
sp = bubble(sp)
finish = time.time()
print(f'm1.sorted {round((finish-start)*1000)} milliseconds')
sp2 = []
op1 = open("m2_reverse.txt")
for i in op1:
  sp2.append(int(i))
start2 = time.time()
sp = bubble(sp2)
finish2 = time.time()
print(f'm2.reverse {round((finish2-start2)*1000)} milliseconds')
sp3 = []
op2 = open("m3_shuffle.txt")
for i in op2:
  sp3.append(int(i))
start3 = time.time()
sp = bubble(sp3)
finish3 = time.time()
print(f'm3.shuffle {round((finish3-start3)*1000)} milliseconds'  )